

def code = params.code
log.info "code: $code"
log.info "obtiene el token...."



def urlToken = "https://graph.facebook.com/oauth/access_token?client_id=271663946193404&redirect_uri=http://pazofeisbuk.appspot.com/datetime&scope=offline_access&client_secret=46f50db913c2d225142fc3e1818d08a3&code=$code" 

//redirect urlToken

def htmlBytes = urlFetch.fetch(new URL(urlToken)).content
def html = new String(htmlBytes)

log.info "html: $html"

request.setAttribute 'token', html

forward '/WEB-INF/pages/datetime.gtpl'

